package One;

public class PersonSortable implements Comparable<PersonSortable> {

	public String toString() {
		return name + "-" + age;
	}

	private String name;
	private int age;

	public PersonSortable(String name, int age) {
		super();
		this.name = name;
		this.age = age;
	}

	@Override
	public int compareTo(PersonSortable o) {
		if (name.compareTo(o.name) == 0) {
			return age - o.age;
		}
		return name.compareTo(o.name);
	}

}
